const path = require('path');
const roots = process.cwd();     /* 工作根目录 */
const contextPath = path.join(roots, 'src'); /* 开发编译目录 */
const execRet = /(fe-(?:[^-]+)-(?:pc|h5))\/?.*\/(v[\d]+)/.exec(__dirname);
const projectName = execRet[1];  /* fe-article-pc */
const version = execRet[2];      /* v5或 v6... */
const projectPort = `${execRet[1]}/${execRet[2]}`;  /* fe-article-pc/v5 */
const publicPath = `//concat.lietou-static.com/${projectPort}/`; /* 公共路径 */
const devPath = path.join(roots, `asset-dev/${version}`); /* 开发编译结果目录 */
const prdPath = path.join(roots, `asset/${version}`); /* 生产编译结果目录 */
const devAsset = path.join(roots, 'asset-dev');
const prdAsset = path.join(roots, 'asset');
const sourcemapAsset = path.join(roots, 'sourcemap');
const srcPath = path.join(roots, 'src');
const staticPath = path.join(roots, 'src/static');
const dllPath = path.join(staticPath, 'js/common');
const configPath = path.join(roots, 'config/lib');

module.exports = {
  roots,
  contextPath,
  devPath,
  prdPath,
  publicPath,
  projectName,
  projectPort,
  version,
  devAsset,
  prdAsset,
  sourcemapAsset,
  configPath,
  srcPath,
  staticPath,
  dllPath,
};
